Repository navigation
fix(C-0312, C-0313): match Substrate WorkerPool at ate.dev/v1 - #217
Conversation
Substrate serves WorkerPool only at ate.dev/v1 since v0.7.0-alpha1. Keep v1alpha1 for older installs and test against a v1-only CRD like current Substrate. Signed-off-by: Harshit Kudhial <122823756+harshitnub077@users.noreply.github.com>
Say C-0312 and C-0313 apply to WorkerPool at both versions and point the WorkerPool field reference at Substrate's v1 types at v1.0.1. Signed-off-by: Harshit Kudhial <122823756+harshitnub077@users.noreply.github.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Substrate v0.0.0 called the field spec.ateomImage. Signed-off-by: Harshit Kudhial <122823756+harshitnub077@users.noreply.github.com>
matthyx
left a comment
There was a problem hiding this comment.
Reviewed head e7b1f38 against main.
Verdict: approve.
- Need: Substrate serves WorkerPool only at
ate.dev/v1from v1.0.0, so thev1alpha1-only rule in C-0312/C-0313 never sees current installs. Real bug, tracked in regolibrary#1011 (companion regolibrary#1015). - Fix: adds
v1next tov1alpha1in both policies, so older installs stay covered. The CEL expressions are version-agnostic. The test CRD now serves onlyv1, which keeps thematchPolicy: Equivalentconversion from hiding the bug. - Before/After proof: present in the description, with failing-then-passing control tests (C-0312 17/2 → 19/0, C-0313 62/4 → 66/0).
- CI: I approved the
action_requiredrun after checking the PR touches no workflows or scripts.main-policy-automationrun 47036854810 completed successfully (test-policy-expressionsandtest-all-policies). CodeRabbit, DCO and FOSSA also pass. - Duplicates: no overlapping PRs. #128 and #103 are the earlier merged WorkerPool work. The author has only this one open PR.
- Not done: I did not run the tests locally. The assessment rests on static review plus the green CI run.
- Blockers: none. No nonblocking gaps, so no follow-up issue.
Overview
The VAPs for C-0312 and C-0313 match Substrate's
WorkerPoolonly atate.dev/v1alpha1. Substrate serves it only atate.dev/v1from v1.0.0 on (v0.7.0-alpha1 in the kagent-dev build that kagent 1.0.x installs), so on a current install these policies never see a WorkerPool. This is the cel-admission-library half of kubescape/regolibrary#1011; the regolibrary half is kubescape/regolibrary#1015.This PR:
v1next tov1alpha1in theate.devrule of both policies (one line each), so older Substrate installs stay covered;WorkerPoolversion fromv1alpha1tov1, and theagent-worker-pool.yamltest resource toate.dev/v1, so the tests run against what Substrate serves today;agent-runtime-posture.md, which said WorkerPool isate.dev/v1alpha1only, and points the WorkerPool field reference at Substrate's v1 types at v1.0.1 (same change as the regolibrary docs in fix(rules): match Substrate WorkerPool at ate.dev/v1 in C-0312, C-0313 and C-0317 regolibrary#1015).The test CRD serves only
v1on purpose. With both versions served, the API server's defaultmatchPolicy: Equivalentconverts av1request and applies thev1alpha1-only policy anyway, which hides the bug. Real Substrate serves nov1alpha1, so there's nothing equivalent to match.How to Test
scripts/run-all-control-tests.shflow (test CRDs fromtest-resources/agent-sandbox-test-crds.yaml, thenrun-control-tests.pyper control), on kind with Kubernetes v1.37.0, for C-0312 and C-0313.python3 -m unittest discover -s scripts -p 'test_*.py'andgo test ./...intools/celclipass too.Before (main's policies, same
v1-only test CRD)The insecure WorkerPools are admitted because the policy never applies to
v1.After (this branch)
Related issues/PRs:
@dakshhhhh16 here's the VAP side, as you asked.
Summary by CodeRabbit
ate.dev/v1andate.dev/v1alpha1for create and update operations. Existing image validation remains unchanged.